<%@page import="java.util.ArrayList"%>
<%@page import="com.itwill.ecom.product.ProductBeans"%>
<%@page import="java.util.List"%>
<%@page import="com.itwill.ecom.product.ProductService"%>
<%@page import="org.springframework.web.context.support.WebApplicationContextUtils"%>
<%@page import="org.springframework.web.context.WebApplicationContext"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%
	WebApplicationContext webContexts = WebApplicationContextUtils.getWebApplicationContext(application);
	ProductService productService = (ProductService)webContexts.getBean("productService");
	
	List<ProductBeans> product = new ArrayList<ProductBeans>();
	product = productService.getProductAll();
%>

	<!-- 인기상품 -->
	<div id="product_list">
		<h2 class="title text-center">신상품</h2>
		<%for(ProductBeans beans : product){
			if(beans.getProduct_no() <= 6){
		%>
		<div class="col-sm-4">
			<div class="product-image-wrapper">
				<div class="single-products">
					<div class="productinfo text-center">
						<img src="resources/images/product/<%=beans.getProduct_image0()%>"/>
						<h4><%= beans.getProduct_name() %></h4>
						<p><fmt:formatNumber value="<%= beans.getProduct_price() %>" pattern=",###"/>원</p>
						<a href="product/productDetail?productno=<%= beans.getProduct_no() %>" class="btn btn-default add-to-cart"><i
							class="fa fa-shopping-cart"></i>상세보기</a>
					</div>
				</div>
				
			</div>
		</div>
		<%
			}
		} %>
	</div>
